home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
PROGRAM
/
PCW_C.ARJ
/
DEMO_B.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-12-28
|
2KB
|
51 lines
/***************************************************************/
/* File Id. DEMO_B.C. */
/* Author. Stan Milam. */
/* Date Written. 21 Dec. 91. */
/* */
/* This program creates an advertisment for the C language us- */
/* a window that moves around on the screen. */
/* */
/***************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "pcwproto.h"
#define rnd(x) (rand() % (x))
int demo_b (void) {
WNDPTR *wnd;
time_t timer;
int tl, bl, wr, wc, lcv, ch;
int mxr, mxc;
static char *msg[] = {
"Welcome to C",
"The Powerful Language",
"for",
"Major Applications Software",
NULL
};
/* Create a box with a advertisment for the C language */
get_cursor_size(&tl,&bl);
set_cursor_size(0,0);
chk_video_state(&mxr,&mxc);
bordercolor(YELLOW,BLUE);
wnd = wframe(7,19,15,60,LIGHTGRAY,BLUE);
q_block_write(9,CENTER,LIGHTGRAY,BLUE,msg);
time(&timer); srand(timer); ch = keywait(3);
for (lcv = 0; lcv < 10 && ch != 27; lcv++) {
wr = rnd(mxr)+1; wc = rnd(mxc)+1;
if ( mpresent ) hide_mouse();
wndmove(wnd,wr,wc);
if ( mpresent ) show_mouse();
ch = keywait(3);
}
wpop(wnd); set_cursor_size(tl,bl);
return 0;
}